package com.xbongbong.paas.domain.entity.ext;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.enums.DateTimeEnum;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * @author: wufeng
 * @date: 2018/8/20 16:57
 * @desrcption:
 */

@Getter
@Setter
public class ConditionsEntityExt implements Serializable,Cloneable {

    private static final long serialVersionUID = 7840169627016698861L;

    /**
     * 字段
     */
    private String attr;
    /**
     * 多表的原始字段
     */
    private String originalAttr;

    /**
     * 字段对应的标题
     */
    private String name;

    /**
     * 子表单对应的标题
     */
    private String subName;
    /**
     * 子表单的字段
     */
    private String subAttr;

    /**
     * 字段类型
     */
    private Integer fieldType;

    /**
     * 判断条件
     * @see com.xbongbong.paas.enums.ConditionEnum
     */
    private String symbol;

    /**
     * 未填写
     */
    private Integer hasEmpty;

    /**
     * 值
     */
    private List<Object> value;
    /**
     * 值类型，默认为空
     * @see com.xbongbong.paas.enums.RangeScreenTypeEnum
     */
    private Integer valueType;

    /**
     * 关联的表单
     */
    private Integer refType;
    /**
     * 关联的表单名称
     */
    private Integer refName;
    /**
     * 是否排序字段
     */
    private Integer  sort;

    /**
     * 是否为穿透筛选条件
     */
    private Integer penetrateFlag;
    /**
     * 用于key、value对应字段回显
     */
    private JSONArray selectItems;

    /**
     * 是否属于或条件
     */
    private Boolean shouldFlag;

    /**
     * 团队类型，如课件
     */
   private Integer teamType;
    /**
     * 表单id
     */
   private Long formId;
    /**
     * 业务类型
     */
   private Integer businessType;

    /**
     * 是否显示离职人员
     */
   private Integer leaveMarks;

    /**
     * 自定义动态
     * @see com.xbongbong.pro.statistic.enums.DateTypeEnum
     * @see com.xbongbong.pro.statistic.enums.DateWayEnum
     */
   private JSONObject dynamicDate;

    /**
     * 常用类型
     * @see com.xbongbong.pro.statistic.enums.NormalTypeEnum
     */
   private Integer normalType;

    /**
     * 枚举值表示 格式 yyyy-MM-dd 或者 yyyy-MM-dd HH:mm
     * @see DateTimeEnum
     */
    private String dateType;


    public ConditionsEntityExt(String attr, String subAttr, Integer fieldType, String symbol, List<Object> value) {
        super();
        this.attr = attr;
        if (!Objects.isNull(subAttr) && !subAttr.isEmpty()){
            this.subAttr = subAttr;
        }
        this.fieldType = fieldType;
        this.symbol = symbol;
        this.value = value;
    }

    public ConditionsEntityExt(String attr, String name, String symbol, List<Object> value, Integer fieldType) {
        super();
        this.attr = attr;
        this.name = name;
        this.fieldType = fieldType;
        this.symbol = symbol;
        this.value = value;
    }

    public ConditionsEntityExt(String attr, String subAttr, Integer fieldType, String symbol) {
        super();
        this.attr = attr;
        if (!Objects.isNull(subAttr) && !subAttr.isEmpty()){
            this.subAttr = subAttr;
        }
        this.fieldType = fieldType;
        this.symbol = symbol;
    }
    public ConditionsEntityExt(){
        hasEmpty = 0;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    protected Object clone2(){
        return new Object();
    }


}
